package com.gimi.cloud.jimi.manage.consumer.service.userInfo.impl;

import com.gimi.cloud.jimi.common.utils.JsonUtil;
import com.gimi.cloud.jimi.common.utils.reqhead.Response;
import com.gimi.cloud.jimi.common.utils.reqhead.Util;
import com.gimi.cloud.jimi.dto.app.moreInfo.MoreInfoDTO;
import com.gimi.cloud.jimi.dto.userInfo.RdJxlDTO;
import com.gimi.cloud.jimi.dto.userInfo.RdMiguanDTO;
import com.gimi.cloud.jimi.dto.userInfo.RdTdDTO;
import com.gimi.cloud.jimi.manage.consumer.feign.MoreInfoFeignService;
import com.gimi.cloud.jimi.manage.consumer.service.userInfo.MoreInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Service
public class MoreInfoServiceImpl implements MoreInfoService {
    @Autowired
    private MoreInfoFeignService moreInfoFeignService;

    private static Logger logger = LoggerFactory.getLogger(MoreInfoServiceImpl.class);
    @Override
    public Response jxlInfo(String body, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        logger.info("请求参数===>" + JsonUtil.replaceNow(body));
        RdJxlDTO dto = JsonUtil.jsonToBean(body,RdJxlDTO.class);

        return moreInfoFeignService.jxlInfo(dto);
    }

    @Override
    public Response tdInfo(String body, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        logger.info("请求参数===>" + JsonUtil.replaceNow(body));
        RdTdDTO dto = JsonUtil.jsonToBean(body,RdTdDTO.class);

        return moreInfoFeignService.tdInfo(dto);
    }

    @Override
    public Response miguanInfo(String body, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        logger.info("请求参数===>" + JsonUtil.replaceNow(body));
        RdMiguanDTO dto = JsonUtil.jsonToBean(body,RdMiguanDTO.class);

        return moreInfoFeignService.miguanInfo(dto);
    }

    @Override
    public Response moreinfo(String body, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        logger.info("请求参数===>" + JsonUtil.replaceNow(body));
        MoreInfoDTO dto = JsonUtil.jsonToBean(body,MoreInfoDTO.class);

        return moreInfoFeignService.moreinfo(dto);
    }
}
